﻿using BussinesLayer.Services;
using Microsoft.AspNet.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Mvc4.Hubs
{
    public class WishListsHub : Hub
    {
        private UserServices us = new UserServices();

        public void AddWishList(int userId, int siteId, decimal longitude, decimal latitude, decimal radius)
        {
            long wlId = us.AddWishList(userId, siteId, longitude, latitude, radius);

            Clients.Caller.ConfirmAddWishList(wlId);
        }

        public void EditWishList(int wishId, decimal longitude, decimal latitude, decimal radius)
        {
            us.ModifyWishList(wishId, longitude, latitude, radius);
        }

        public void AddCriterion(int userId, int siteId, int attributeId, string criterion)
        {
            long cId = us.AddCriterion(userId, siteId, attributeId, criterion);

            Clients.Caller.ConfirmAddWishList(cId);
        }

        public void EditCriterion(int critId, string value)
        {
            us.ModifyCriterion(critId, value);
        }

        public void DeleteCriterion(int critId)
        {
            us.DeleteCriterion(critId);
        }
    }
}